package com.exce1;

import java.util.Scanner;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author WaveHi
 * @Date 13/8/2021 上午 10:35
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description 模拟小球运动
 */
public class FallDemo {

    public static void main(String[] args) {

        //接收运动的距离
        double sum = 100;

        //接收反弹高度
        double bounceHeight = 100.0 / 2;

        //接收接触地面的次数
        int count = 10;

        //循环模拟小球的运动
        for(int i = 1;i < count;i++) {

            //计算运动距离
            sum += bounceHeight * 2;

            //计算反弹高度
            bounceHeight /= 2;

        }

        //输出结果
        System.out.println("The motion distance of the ball is :" + sum);
        System.out.println("The 10th ball contacting with ground be bounced up to "
                + bounceHeight + " meters high.");

    }

}
